package
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.text.TextField;
	
	public class View extends Sprite
	{
		private var _txt:TextField;
		private var _model:Model;
		private var _control:Control;
		
		public function View(model:Model, control:Control, txt:TextField)
		{
			_model = model;
			_control = control;
			
			_txt = txt;
			_model.addEventListener("setHour", setHandler);
			_model.addEventListener("setMinute", setHandler);
			_model.addEventListener("setSecond", setHandler);
			
			control.starUp();
		}
		
		private function setHandler(e:Event):void
		{
			if(_model.hour!=null && _model.minute!=null && _model.second!=null)
				_txt.text = _model.hour + ":" + _model.minute + ":" + _model.second;
		}
	}
}